<!DOCTYPE html>
<!--
  Copyright 2011 Google Inc. All Rights Reserved.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<html>
  <head>
    <meta charset="UTF-8">

    <title>Fusion Tables API Example: Google Chart Tools Data Table</title>

    <link href="/apis/fusiontables/docs/samples/style/default.css"
        rel="stylesheet" type="text/css">
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load('visualization', '1', { packages: ['table'] });

      function drawTable() {
        var query = "SELECT 'Scoring Team' as Scoring, " +
            "'Receiving Team' as Receiving, 'Minute of goal' as Minute " +
            'FROM 1VlPiBCkYt_Vio-JT3UwM-U__APurJvPb6ZEJPg';
        var team = document.getElementById('team').value;
        if (team) {
          query += " WHERE 'Scoring Team' = '" + team + "'";
        }
        var queryText = encodeURIComponent(query);
        var gvizQuery = new google.visualization.Query(
            'http://www.google.com/fusiontables/gvizdata?tq=' + queryText);

        gvizQuery.send(function(response) {
          var table = new google.visualization.Table(
              document.getElementById('visualization'));
          table.draw(response.getDataTable(), {
            showRowNumber: true
          });
        });
      }

      google.setOnLoadCallback(drawTable);
    </script>
  </head>
  <body>
    <div>
      <label>Scoring Team:</label>
      <select id="team" onchange="drawTable();">
        <option value="">All</option>
        <option value="Germany">Germany</option>
        <option value="New Zealand">New Zealand</option>
        <option value="Uruguay">Uruguay</option>
      </select>
    </div>
    <div id="visualization"></div>
  </body>
</html>